import { createRouter, createWebHashHistory } from 'vue-router'
import Home from '../views/Home'

// import upload from "../components/upload/upload";
const routes = [

  {
    path: '/',redirect:'/login'
  },
  {
    path: '/login',
    name: 'Login',
    component: ()=>import('../views/Login/login')
  },
  {
    path: '/home',
    name: 'Home',
    component: Home
  },
  // {
  //   path:'/upload',
  //   name:"Upload",
  //   component: upload
  // }

]


const router = createRouter({
  history: createWebHashHistory(),
  routes
})

// router.beforeEach((to,from,next)=>{
//   if(to.path==='/login') return next()
//   const tokenStr=window.localStorage.getItem('token')
//   if(!tokenStr) return next('/login')
//   next()
// })

export default router
